package Servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/ServletDemo12")
public class ServletDemo12 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
        ServletContext s1= request.getServletContext();
        ServletContext s2 = this.getServletContext();
        System.out.println(s1);
        System.out.println(s2);
        String name="h.jpeg";
        String mimeType = s1.getMimeType(name);
        System.out.println(mimeType);
        s1.setAttribute("name","张三炮");
    }
}
